import { defineStore } from "pinia";
import { type ContentModel, getDynamicData, getSellCountDesc } from "@/api/discovery/integrated";

export const useDiscoveryIntegratedStore = defineStore({
    id: "discoveryIntegrated",
    state: () => {
        return {
            // 用于存储动态数据
            integratedData: [] as ContentModel[],
        };
    },
    actions: {
        // 获取动态数据
        async getIntegratedDataAsync() {
            const res = await getDynamicData();
            this.integratedData = res.content;
        },
        // 获取销量排序数据
        async getSellCountDescAsync() {
            this.integratedData = await getSellCountDesc();
        },
    },
});
